<template>
  <div class="page-container">
    <PanelTab @change="handleChange">
      <template slot="end">
        <el-button size="mini" type="primary" style="margin-left: 10px" @click="handleExport">导出</el-button>
      </template>
    </PanelTab>
    <div class="page-content">
      <el-row :gutter="10">
        <el-col :span="24">
          <Panel1 :time="time" title="发布量走势图" />
        </el-col>
        <el-col :span="24">
          <PanelChart :time="time" chartType="bar" title="独享·地区概况" :api="apiDuxArea" param="sheng_id" />
        </el-col>
        <el-col :span="12">
          <PanelChart :time="time" chartType="pie" title="独享·分类概况" :api="apiDuxCls" param="cate_id" />
        </el-col>
        <el-col :span="12">
          <Panel3 :time="time" title="AI线索转化概况" />
        </el-col>
        <el-col :span="24">
          <Panel2 :time="time" title="独享信息覆盖会员情况" />
        </el-col>
        <el-col :span="12">
          <PanelChart :time="time" chartType="bar" title="电话回访概况" :api="apiDuxPhone" param="" />
        </el-col>
        <el-col :span="12">
          <PanelChart :time="time" chartType="pie" title="处置周期" :api="apiDuxCycle" param="" />
        </el-col>
      </el-row>
    </div>

    <!--  导出 -->
    <el-dialog title="导出" :visible.sync="showDialogExport">
      <DialogExport v-if="showDialogExport" type="alone" :time="time" @close="showDialogExport = false" @success="handleExportSuccess" />
    </el-dialog>
  </div>
</template>

<script>
import { apiDuxCls, apiDuxArea } from '@/api/index'
import { apiDuxCycle, apiDuxPhone } from '@/api/dataStatistics/index'
import PanelTab from '@/components/panel/PanelTab.vue'
import PanelChart from '@/components/panel/PanelChart.vue'
import Panel1 from './components/Panel1.vue'
import Panel2 from './components/Panel2.vue'
import Panel3 from './components/Panel3.vue'
import DialogExport from '../components/DialogExport.vue'

export default {
  name: 'AloneData',
  components: { PanelTab, PanelChart, Panel1, Panel2, Panel3, DialogExport },
  data() {
    return {
      time: {},
      showDialogExport: false,
      apiDuxCls,
      apiDuxArea,
      apiDuxCycle,
      apiDuxPhone,
    }
  },
  mounted() {},
  destroyed() {},
  methods: {
    // 时间变动
    handleChange(time) {
      this.time = time
    },
    // 导出
    handleExport() {
      this.showDialogExport = true
    },
    handleExportSuccess() {
      this.showDialogExport = false
    },
  },
}
</script>

<style scoped lang="scss">
.page-content {
  padding-top: 62px;
}
</style>
